#include <algorithm>
#include <iostream>
#include <set>
using namespace std;
const int N = 1e5 + 7;
struct node {
    int ts, id;
    bool operator<(const node& b) const { return this->ts < b.ts; }
} p[N];

int like[N];

int main() {
    int n, d, k, head = 1;
    cin >> n >> d >> k;
    for (int i = 1; i <= n; ++i)
        cin >> p[i].ts >> p[i].id;
    sort(p + 1, p + n + 1);
    set<int> s;
    for (int i = 1; i <= n; ++i) {
        ++like[p[i].id];
        while (p[i].ts >= p[head].ts + d)
            --like[p[head++].id];
        if (like[p[i].id] >= k)
            s.insert(p[i].id);
    }
    for (int x : s) {
        cout << x << '\n';
    }
    return 0;
}